import 'package:flutter/material.dart';
// import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:get/get.dart';
import 'package:tiktokadult/config/config.dart';
import 'package:tiktokadult/hj_model/splash/domain_source_model.dart';
import 'package:tiktokadult/tools_base/widget/net_image_widget.dart';

class UserAwardView extends StatelessWidget {
  final List<int>? awards;
  final double? size;
  const UserAwardView({super.key, this.awards, this.size});

  @override
  Widget build(BuildContext context) {
    // if (awards?.isEmpty ?? true) return SizedBox.shrink();
    // if (Config.userAwards.isEmpty) {
    //   debugPrint('后端没有返回奖章');
    //   return SizedBox.shrink();
    // }
    UserAward? awardM;
    awards?.reversed.forEach((element) {
      if (awardM == null) {
        awardM = Config.userAwards.firstWhereOrNull((e) => e.number == element);
      }
    });
    if (awardM == null) return SizedBox.shrink();

    return NetworkImageLoader(
      imageUrl: awardM?.imgUrl ?? '',
      width: 18,
      height: 18,
    );
  }
}
